/*
 * hoolog.h
 *
 *  Created on: Apr 13, 2012
 *      Author: benoybose
 */

#ifndef HCLOG_H_
#define HCLOG_H_

#include <stdio.h>

extern const int HOO_LOG_LEVEL_ERROR; // = 0;
extern const int HOO_LOG_LEVEL_DEBUG; // = 1;
extern const int HOO_LOG_LEVEL_INFO; // = 3;

/**
 * Initialize logging system with a filename
 * @param filename - Name of the log file
 */
void hclog_init(char* filename);

/**
 * Initialize logging system with a stream
 * @param pointer to the file stream
 */
void hclog_init_file(FILE* file);

/**
 * Write log to the file/stream
 * @param module Name of the module
 * @param level Level of the log
 * @param file Name of the file
 * @param line Line number
 * @param message The text message to be printed on
 */
void hclog_log(const char* module, int level, const char* file, const char* func, int line, const char* message);


#if defined(HOOLOG)
#define LOGINIT(file) hclog_init_file(file)
#define LOG_ERROR(_module,_message) hclog_log(_module, HOO_LOG_LEVEL_ERROR, __FILE__, __func__, __LINE__, _message);
#define LOG_DEBUG(_module,_message) hclog_log(_module, HOO_LOG_LEVEL_DEBUG, __FILE__, __func__, __LINE__, _message);
#define LOG_INFO(_module,_message) hclog_log(_module, HOO_LOG_LEVEL_INFO, __FILE__, __func__, __LINE__, _message);
#else
#define LOGINIT(file) ;
#define LOG_ERROR(_module,_message) ;
#define LOG_DEBUG(_module,_message) ;
#define LOG_INFO(_module,_message) ;
#endif

#endif /* HCLOG_H_ */
